Kameleon-Plus  0.3.2
Shue.h
Go to the documentation of this file.
1 /*
2  * IMF.h
3  *
4  * Created on: Aug 11, 2008
5  * Author: dberrios
6  */
7 #ifdef __cplusplus
8 #ifndef SHUE_H_
9 #define SHUE_H_
10 #include <string>
11 #include <vector>
12 #include <time.h>
13 #include <ctime>
14 using namespace std;
15 
16 struct IMFdata
17 {
18  int year;
19  int month;
20  int day;
21  int hour;
22  int min;
23  int sec;
24  int msec;
25  float bx;
26  float by;
27  float bz;
28  float vx;
29  float vy;
30  float vz;
31  float n;
32  float t;
33  time_t epoch;
34  float shue_r0;
35  float d_p;
36 
37 
38 };
39 
40 class IMF
41 {
42 
43  public:
44  IMF();
45  void open(std::string filename);
46  void interpolate(time_t targetTime, float xPosition, float& radius, bool& isInside);
47  int size();
48  IMFdata& operator[] (int i);
49  virtual ~IMF();
50  void calculateMagnetopause(const time_t& targetTime, vector<float>& xPositions, vector<float>& radii,
51  float nightSideExtent, int slices);
52 
53 
54 
55 
56  private:
57  IMFdata parse(const std::string &line);
58  vector<IMFdata> imfdata;
59  IMFdata interpolateIMFData(int & index, time_t & transitTime);
60  int parseInt(const std::string &str);
61  float parseFloat(const std::string &str);
62  int exactDateComparison ( const time_t& targetTime, int mid);
63  int betweenDateComparison (const time_t& targetTime, int test);
64  int bSearchTime(const time_t& targetTime, int low, int high);
65  float bSearchMagnetopauseStart(const time_t& targetTime, const float& low, const float& high);
66  int magnetopauseComparison( const time_t& targetTime, const float& mid);
67  float interpolateFloat(float before, float after, float percentage);
68 
69 };
70 
71 class Shue
72 {
73  public:
74  Shue();
75  void open(std::string filename);
76 };
77 #endif //__cplusplus
78 
79 #endif /* SHUE_H_ */